﻿/*
 * This file is part of the Kompromiss Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
/*using System.Linq;*/
using System.Text;
/*using System.Threading.Tasks;*/
using System.Windows.Forms;
using System.Net;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Kompromiss
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            label2.Text = System.Environment.MachineName;

            foreach (System.Net.IPAddress ip in System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList)
            {
                label4.Text = ip.ToString();
            }   
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = true;
            this.WindowState = FormWindowState.Minimized;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.Location = new Point(
                Screen.PrimaryScreen.WorkingArea.Right - this.Width,
                Screen.PrimaryScreen.WorkingArea.Bottom - this.Height);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            
        }

        private void Form_Resize(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.Hide();
                notifyIcon1.Visible = true;
            }
        }

        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
        {
            this.Show();
            this.WindowState = FormWindowState.Normal;
            notifyIcon1.Visible = false;
        }

        private void label2_Click(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void label4_Click(object sender, EventArgs e)
        {

            

        }

        private void button2_Click_1(object sender, EventArgs e)
        {
          
            
            if (System.IO.Directory.Exists(@"C:\Users\Public\Desktop\" ) == true) 
            {
                /*MessageBox.Show("У вас Win 7");*/
                System.Diagnostics.Process MyProc = new System.Diagnostics.Process();
                MyProc.StartInfo.FileName = @"C:\Users\Public\Desktop\HelpDesk.lnk";
                MyProc.Start();
            }
            else if (System.IO.Directory.Exists(@"C:\Documents and Settings\All Users\Desktop\") == true) 
            {
               /* MessageBox.Show("У вас Win XP");*/
                System.Diagnostics.Process MyProc = new System.Diagnostics.Process();
                MyProc.StartInfo.FileName = @"C:\Documents and Settings\All Users\Desktop\HelpDesk.lnk";
                MyProc.Start();
            }        
                                 

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            Process.Start(@"AA_v3.4.exe");
        }

        
    }
}
